{% extends 'base.html' %}
{% block content %}
<h2>卡流量预警管理</h2>
<table class="table">
    <thead>
        <tr>
            <th>卡ICCID</th>
            <th>预警阈值</th>
            <th>当前流量</th>
            <th>是否激活</th>
            <th>创建时间</th>
        </tr>
    </thead>
    <tbody>
        {% for w in page_obj %}
        <tr>
            <td>{{ w.card.iccid }}</td>
            <td>{{ w.threshold }}</td>
            <td>{{ w.current_flow }}</td>
            <td>{{ w.is_active|yesno:"是,否" }}</td>
            <td>{{ w.created_at }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>
<!-- 分页控件 -->
<nav aria-label="Page navigation">
  <ul class="pagination">
    {% if page_obj.has_previous %}
      <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">上一页</a></li>
    {% else %}
      <li class="page-item disabled"><span class="page-link">上一页</span></li>
    {% endif %}
    {% for num in page_obj.paginator.page_range %}
      {% if page_obj.number == num %}
        <li class="page-item active"><span class="page-link">{{ num }}</span></li>
      {% else %}
        <li class="page-item"><a class="page-link" href="?page={{ num }}">{{ num }}</a></li>
      {% endif %}
    {% endfor %}
    {% if page_obj.has_next %}
      <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">下一页</a></li>
    {% else %}
      <li class="page-item disabled"><span class="page-link">下一页</span></li>
    {% endif %}
  </ul>
</nav>
{% endblock %}
